/*
 * © Copyright 2011 Romain Marteau, Matthieu Totet
 * 
 *    This file is part of VineaToum.
 *
 *    VineaToum is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    VineaToum is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with VineaToum.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.vineatoum.view.utils.jtablecustom;

import java.util.Vector;

public class OwnerTable extends TableListener {
	private String name;

	public OwnerTable() {
		// TODO Auto-generated constructor stub
	}

	public OwnerTable(String name) {
		this.name = name;
	}

	@Override
	public TableListener getNewInstance() {
		return new OwnerTable();
	}

	@Override
	public Vector<Object> getVectorData() {
		Vector<Object> vector = new Vector<Object>();
		vector.add(name);
		return vector;
	}

	@Override
	public void updateField(String field, Object value) {
		try {
			name = (String) value;
		} catch (ClassCastException e) {
			// TODO: handle exception
			e.printStackTrace();
		}
	}

	@Override
	public Vector<String> getVectorColumns() {
		Vector<String> vector = new Vector<String>();
		vector.add("Nom");
		return vector;
	}

	@Override
	public String toString() {
		return name;
	}

	public String getName() {
		return name;
	}

}
